package io.netty.util.concurrent;

//除了想知道结果以外，可能还想知道任务执行的进度，所以，又提供了ProgressivePromise接口去提供了进度相关的方法。
public interface ProgressivePromise<V> extends Promise<V>, ProgressiveFuture<V> {

    ProgressivePromise<V> setProgress(long progress, long total);
    //try是因为可能已经完成了或者超出进度最大范围了，就什么都不做返回失败
    boolean tryProgress(long progress, long total);




    @Override
    ProgressivePromise<V> setSuccess(V result);

    @Override
    ProgressivePromise<V> setFailure(Throwable cause);

    @Override
    ProgressivePromise<V> addListener(GenericFutureListener<? extends Future<? super V>> listener);

    @Override
    ProgressivePromise<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners);

    @Override
    ProgressivePromise<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener);

    @Override
    ProgressivePromise<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners);

    @Override
    ProgressivePromise<V> await() throws InterruptedException;

    @Override
    ProgressivePromise<V> awaitUninterruptibly();

    @Override
    ProgressivePromise<V> sync() throws InterruptedException;

    @Override
    ProgressivePromise<V> syncUninterruptibly();
}
